package zd.cornermemory.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import zd.cornermemory.R;
import zd.cornermemory.ui.AboutActivity;
import zd.cornermemory.ui.HTMLActivity;
import zd.cornermemory.ui.HelpActivity;
import zd.cornermemory.ui.SettingActivity;

/**
 * Created by zhud on 2019/4/29.
 */

public class SettingFragment extends Fragment implements View.OnClickListener{
    private RelativeLayout       setting_layout;
    private RelativeLayout       search_layout;
    private RelativeLayout       help_layout;
    private RelativeLayout       about_layout;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.tab4, container, false);
        setting_layout = view.findViewById(R.id.setting_layout);
        search_layout = view.findViewById(R.id.search_layout);
        help_layout = view.findViewById(R.id.help_layout);
        about_layout = view.findViewById(R.id.about_layout);
        setting_layout.setOnClickListener(this);
        search_layout.setOnClickListener(this);
        help_layout.setOnClickListener(this);
        about_layout.setOnClickListener(this);
        return view;
    }

    @Override
    public void onClick(View view) {
        Intent intent = null;
        switch (view.getId()) {
            case R.id.setting_layout:
                intent = new Intent(getActivity(), SettingActivity.class);
                startActivity(intent);
                break;
            case R.id.search_layout:
//                intent = new Intent(getActivity(), QueryActivity.class);
                intent = new Intent(getActivity(), HTMLActivity.class);
                startActivity(intent);
                break;
            case R.id.help_layout:
                intent = new Intent(getActivity(), HelpActivity.class);
                startActivity(intent);
                break;
            case R.id.about_layout:
                intent = new Intent(getActivity(), AboutActivity.class);
                startActivity(intent);
                break;
        }
    }
}
